<?php
/**
 * Created by PhpStorm.
 * User: THINK
 * Date: 2017/8/31
 * Time: 14:58
 */
namespace Admin\Controller;
use Think\Controller;
class SpecialController extends Controller {

    public function index(){

        $key = '';

        $where = '';

        if( I('keyword') ){

            $where = "a.title like '%".I('keyword')."%' ";

            $key = I('keyword');

        }

        $User = M('special');

        $count = $User->count();

        $Page = new \Think\Page($count,C('limitPage'));

        $show = $Page->show();

        $list = $User->alias('a')->field('a.id,a.title,a.color,a.click,a.updatetime,b.name')->join("xyh_category as b on a.cid = b.id",'left')->where("$where")->limit($Page->firstRow.','.$Page->listRows)->select();

        $Users = M('iteminfo');

        $lists = $Users->where('`group` = "flagtype"')->select();

        $this->assign('list',$list);

        $this->assign('lists',$lists);

        $this->assign('key',$key);

        $this->assign('count',$count);

        $this->assign('page',$show);

        $this->display();

    }

}